﻿using System;
using System.Web;

namespace IFD2
{
    public partial class Office : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ACL"].ToString().IndexOf("UB1") < 0)
            {
                Response.Redirect("unauthorized.aspx");
            }

            KEY.Value = Session["OFFICE"].ToString();
            lblOffice.Text = KEY.Value;
        }

        protected void lbtnQuery_Click(object sender, EventArgs e)
        {
            DetailsView1.DataBind();
        }

        protected void btnUsers_Click(object sender, EventArgs e)
        {
            //string domain = TinyDAL.GetRequestDomain(HttpContext.Current.Request.Url.OriginalString);
            //int port;
            //if (HttpContext.Current.Request.Url.Port != null)
            //    port = HttpContext.Current.Request.Url.Port;
            //else
            //    port = -1;
            if (Application["DEBUG"].ToString() == "1")
                //Response.Redirect(Application["http"] + "/users.aspx");
                //Response.Redirect("http" + domain + "/users.aspx");
                //Response.Redirect("http://" + HttpContext.Current.Request.Url.Host + ":" + Convert.ToInt32(Application["HTTP_PORT"].ToString()).ToString() + Application["WEB_PATH"].ToString() + "/users.aspx");
                Response.Redirect("Users.aspx");
            else
            {
                //Response.Redirect(Application["https"] + "/users.aspx");
                //if (port != -1)
                //{
                //    domain.Replace(":" + port.ToString(), "");
                //}
                //Response.Redirect("https" + domain + "/users.aspx");
                Response.Redirect("https://" + HttpContext.Current.Request.Url.Host + ":" + Convert.ToInt32(Application["HTTPS_PORT"].ToString()).ToString() + Application["WEB_PATH"].ToString() + "/Users.aspx");
            }
        }
    }
}